import tester.*;

/**
 * @author Ryan Cassidy & Adam Blackwell
 */
// Examples tests all things CartPt like.
class Examples {
	
  // Example CartPts.
	CartPt pt1 = new CartPt(5, 5);
	CartPt pt2 = new CartPt(7, 7);
	CartPt pt3 = new CartPt(-5, 7);
	
	// tests the adjust method in the CartPt class
	void testAdjust(Tester t){
		t.checkExpect(pt1.adjust(3, 3), new CartPt(3, 3));
		t.checkExpect(pt3.adjust(3, 3), new CartPt(0, 3));
		t.checkExpect(pt2.adjust(10, 10), pt2);
	}
	
	// tests the fixX and fixY methods in the CartPt class
	void testFixes(Tester t){
		t.checkExpect(pt1.fixX(3, 3), 3);
		t.checkExpect(pt1.fixX(3, 2), 2);
		t.checkExpect(pt1.fixX(-4, 9), 0);
		t.checkExpect(pt1.fixY(3, 3), 3);
		t.checkExpect(pt1.fixY(3, 2), 2);
		t.checkExpect(pt1.fixY(-4, 9), 0);
	}

	// tests the moveRandom method in the CartPt class
	void testMoveRand(Tester t){
		t.checkExpect(pt1.moveRandom(5, 5, 5, 5), new CartPt(10, 10));
		t.checkNumRange(pt1.moveRandom(-2, 2, 4, 4).x, 3, 8);
		t.checkExpect(pt1.moveRandom(-2, 2, 4, 4).y, 9);
	}
	
	// tests the move method in the CartPt class
	void testMove(Tester t){
		t.checkExpect(pt1.move(2, 1), new CartPt(7, 6));
		t.checkExpect(pt1.move(0, 0), pt1);
		t.checkExpect(pt1.move(-2, -2), new CartPt(3, 3));
	}
	
	// tests the closeTo method in the CartPt class
	void testCloseTo(Tester t){
		t.checkExpect(pt1.closeTo(pt2, 4), true);
		t.checkExpect(pt1.closeTo(pt2, 2), false);
	}
	
}
